package cn.stylefeng.guns.cloud.workflow.modular.provider;

import cn.stylefeng.guns.cloud.model.page.PageResult;
import cn.stylefeng.guns.cloud.workflow.api.WorkflowApi;
import cn.stylefeng.guns.cloud.workflow.api.entity.ActBaseEntity;
import cn.stylefeng.guns.cloud.workflow.modular.service.ActBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 流程基础服务提供者
 *
 * @Author xuyuxiang
 * @Date 2019/11/17 23:02
 **/
@RestController
public class WorkflowApiProvider implements WorkflowApi {

    @Autowired
    ActBaseService actBaseService;

    @Override
    public void start(@RequestParam("processDefinitionKey") String processDefinitionKey,
                      @RequestParam("businessId") Long businessId,
                      @RequestBody ActBaseEntity entity,
                      @RequestBody Map paramMap) {

        actBaseService.start(processDefinitionKey, businessId, entity, paramMap);
    }

    @Override
    public void reStart(@RequestBody ActBaseEntity entity) {

        actBaseService.reStart(entity);
    }

    @Override
    public void cancel(@RequestBody ActBaseEntity entity) {

        actBaseService.cancel(entity);
    }

    @Override
    public void fillEntityList(@RequestBody List entityList) {

        actBaseService.fillEntityList(entityList);
    }

    @Override
    public void fillResultList(@RequestBody List resultList) {

        actBaseService.fillResultList(resultList);
    }

    @Override
    public void fillEntityPage(@RequestBody PageResult pageResult) {

        actBaseService.fillEntityPage(pageResult);
    }

    @Override
    public void fillResultPage(@RequestBody PageResult pageResult) {

        actBaseService.fillResultPage(pageResult);
    }
}
